package yns.springboot.guide.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import yns.springboot.guide.demo.configure.Configure;
import yns.springboot.guide.demo.configure.Configure2;
import yns.springboot.guide.demo.configure.Configure3;
import yns.springboot.guide.demo.configure.Configure4;

@RestController
public class TestConfigureController extends BaseController {

	// http://localhost:8080/configure
	// http://localhost:8080/configure2
	// http://localhost:8080/configure3
	// http://localhost:8080/configure4

	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private Configure configure;

	@Autowired
	private Configure2 configure2;

	@Autowired
	private Configure3 configure3;

	@Autowired
	private Configure4 configure4;

	@RequestMapping("/configure")
	public String testConfigure() {
		logger.info(httpServletRequest.getRequestURI());
		return "Test Controller " + configure.getTest() + "-" + configure.getTestName();
	}

	@RequestMapping("/configure2")
	public String testConfigure2() {
		logger.info(httpServletRequest.getRequestURI());
		return "Test Configure2 " + configure2.getName() + "-" + configure2.getPwd() + "-" + configure2.getDb();
	}

	@RequestMapping("/configure3")
	public String testConfigure3() {
		logger.info(httpServletRequest.getRequestURI());
		return "Test Configure3 " + configure3.getName() + "-" + configure3.getPwd();
	}

	@RequestMapping("/configure4")
	public String testConfigure4() {
		logger.info(httpServletRequest.getRequestURI());
		return "Test Configure4 " + configure4.getName() + "-" + configure4.getPwd();
	}

}
